
export const orderTypeChoice = [
  { value: 'DML', label: 'DML', disabled: false },
  { value: 'DDL', label: 'DDL', disabled: false },
  { value: 'Query', label: 'Query', disabled: false }

]

export const dbTypeChoice = [
  { value: 'oracle', label: 'Oracle', disabled: false },
  { value: 'mysql', label: 'MySQL', disabled: false },
  { value: 'oceanbase', label: 'OceanBase', disabled: false }

]
export const statusMap = {
  'open': { 'name': '审核中', 'color': 'primary', icon: 'status-half' },
  'success': { 'name': '已完成', 'color': 'success', icon: 'status-success' },
  'reject': { 'name': '已驳回', 'color': 'error', icon: 'status-reject' },
  'revoke': { 'name': '已撤销', 'color': 'warning', icon: 'status-revoke' }
}

export const orderColumns = _this => [
  {
    title: '任务ID',
    key: 'id',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.id}</span>
    }
  },
  {
    title: '任务类型',
    key: 'order_type',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.orderType}</span>
    }
  },
  {
    title: '任务描述',
    key: 'description',
    render: (h, { row }) => {
      return <span>{row.description}</span>
    }
  },
  {
    title: 'DB类型',
    key: 'db_type',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.dbType}</span>
    }
  },
  {
    title: 'DB集群',
    key: 'db_cluster_name',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.dbClusterName}</span>
    }
  },
  {
    title: 'DB库名',
    key: 'db_database',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.dbDatabase}</span>
    }
  },
  {
    title: 'DB表名',
    key: 'db_table',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.dbTable}</span>
    }
  },
  {
    title: '申请人',
    key: 'create_by',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.createBy}</span>
    }
  },
  {
    title: '执行状态',
    key: 'status',
    sortable: true,
    width: '120px',
    render: (h, { row }) => {
      return <Tag type='border' size='large' color={statusMap[row.status].color}>
        <svg-icon icon-class={statusMap[row.status].icon} />
        {statusMap[row.status].name}
      </Tag>
    }
  },
  {
    title: '申请时间',
    key: 'create_time',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.createTime}</span>
    }
  },
  {
    title: '操作',
    key: 'action',
    sortable: true,
    render: (h, { row }) => {
      return <router-link to={'/ticket/order/' + row.id} style='color: #2d8cf0'>详情</router-link>
    }
  }
]
